<%#
 Copyright 2013-2019 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-%>
<div *ngIf="allBeans">
    <h2 id="configuration-page-heading" jhiTranslate="configuration.title">Configuration</h2>

    <span jhiTranslate="configuration.filter">Filter (by prefix)</span> <input type="text" [(ngModel)]="beansFilter" (ngModelChange)="filterAndSortBeans()" class="form-control">
    <h3 id="spring-configuration">Spring configuration</h3>
    <table class="table table-striped table-bordered table-responsive d-table" aria-describedby="spring-configuration">
        <thead>
        <tr jhiSort predicate="prefix" [(ascending)]="beansAscending" [callback]="filterAndSortBeans.bind(this)">
            <th jhiSortBy="prefix" scope="col" class="w-40"><span jhiTranslate="configuration.table.prefix">Prefix</span> <fa-icon [icon]="'sort'"></fa-icon></th>
            <th scope="col" class="w-60"><span jhiTranslate="configuration.table.properties">Properties</span></th>
        </tr>
        </thead>
        <tbody>
        <tr *ngFor="let bean of beans">
            <td><span>{{ bean.prefix }}</span></td>
            <td>
                <div class="row" *ngFor="let property of bean.properties | keys">
                    <div class="col-md-4">{{ property.key }}</div>
                    <div class="col-md-8">
                        <span class="float-right badge-secondary break">{{ property.value | json }}</span>
                    </div>
                </div>
            </td>
        </tr>
        </tbody>
    </table>
    <div *ngFor="let propertySource of propertySources; let i = index">
        <h4 [id]="'property-source-' + i"><span>{{ propertySource.name }}</span></h4>
        <table class="table table-sm table-striped table-bordered table-responsive d-table" [attr.aria-describedby]="'property-source-' + i">
            <thead>
            <tr>
                <th scope="col" class="w-40">Property</th>
                <th scope="col" class="w-60">Value</th>
            </tr>
            </thead>
            <tbody>
            <tr *ngFor="let property of propertySource.properties | keys">
                <td class="break">{{ property.key }}</td>
                <td class="break">
                    <span class="float-right badge-secondary break">{{ property.value.value }}</span>
                </td>
            </tr>
            </tbody>
        </table>
    </div>
</div>
